home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: thads@csn.net (Thad Smith)
- Newsgroups: comp.lang.c.moderated,comp.std.c
- Subject: Re: 'h' modifier in printf
- Date: 14 Mar 1996 21:23:38 -0600
- Organization: T3 Systems
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4ianrq$het@solutions.solon.com>
- References: <4i801c$455@solutions.solon.com> <4i98fl$8ml@solutions.solon.com>
- Reply-To: ThadSmith@acm.org
- NNTP-Posting-Host: solutions.solon.com
-
- In article <4i98fl$8ml@solutions.solon.com>,
- baynes@ukpsshp1.serigate.philips.nl wrote:
-
- >: int i;
- >: printf("%hd", i);
- >: printf("%d", (short)i);
- >
-
- >I think if the value of i is outside SHRT_MIN to SHRT_MAX then both are
- >undefined for different reasons. The first printf (%hd) because the conversion
- >does not apply to a short integer. The second printf (%d of (short)) because
- >the cast of i to (short) is not defined when i is out of range.
-
- Actually the result of the conversion in the second printf is
- implementaion-defined.
-
- Thad
-